
<?php
	
	include_once( "config.php");
	
			
	// Build SQL Query  
	//$query = "SELECT * FROM tbartifacts WHERE Title LIKE \"%$trimmed%\" OR Text LIKE \"%$trimmed%\" " ; 
	
	$query = "SELECT tbartifacts_type.Id, tbartifacts_type.Name 	          
			  FROM   tbartifacts_type ";
			
	mysql_query("set names utf8");
	 
	$numresults = mysql_query($query);
	 
	if (!$numresults) 
	{
		die('Invalid query: ' . mysql_error());
	}
	 
	$numrows = mysql_num_rows($numresults);
	
	// Writing the table with the query results. 
    
	echo (" <select name='artifactstype_combo' id='artifactstype_combo'>");
	echo ("<option>Artifact Types</option>");
		 
	while ($row = mysql_fetch_assoc($numresults)) 
	{ 	
		echo ("<option value='" . $row["Id"] . "'>" . $row["Name"] . "</option>");
		
	}// while
	
	echo (" </select> ");
		
	
	// If we have no results, offer a google search as an alternative
	
	if ($numrows == 0)
	{
		echo (" <select name='artifactstype_combo' id='artifactstype_combo'>");
		echo ("<option>Artifact Types</option>");
		echo ("<option>No type created</option>");
		echo (" </select> ");
	}//if
	
	  
?>